package com.sky.mapper;
import com.sky.dto.OrdersPageQueryDTO;
import com.sky.entity.Orders;
import com.sky.vo.OrderVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface OrderMapper {
   void add(Orders orders);
   @Select("select * from orders where number = #{orderNumber}")
   Orders getByNumber(String orderNumber);
   void update(Orders orders);
   List<Orders> search(Integer status,Long userId);
   Orders get(Long id);
   List<Orders> pageQuery(OrdersPageQueryDTO ordersPageQueryDTO);
   @Select("select count(id) from orders where status = #{status}")
   Integer countStatus(Integer status);
   OrderVO details(Long id);
   @Select("select * from orders where status=#{status} and order_time<#{time}")
   List<Orders> getByStatusForExpiration(Integer status, LocalDateTime time);
}
